/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package erpretailx;


import erpretailx.Component.ETitlePanel;
import erpretailx.Component.WorkSpacePanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JSplitPane;

/**
 *
 * @author Al Quthsi
 */
public class MainWindow extends JFrame implements ActionListener{

    private static MainWindow singleton;
    private static final Object Lock = new Object();

    private JSplitPane SplitPane = new JSplitPane();
    private ETitlePanel TitlePanel = new ETitlePanel();
    //test

    private WorkSpacePanel workSpacePanel = new WorkSpacePanel();

    private MainWindow(String iTitle, ImageIcon Icon){

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        //Add Workspace Container
        getContentPane().setLayout(new BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS));

        this.setSize(1024, 700);
        TitlePanel.setPreferredSize(new java.awt.Dimension(1024,120));
        SplitPane.setDividerLocation(300);
        SplitPane.setMaximumSize(new java.awt.Dimension(2000,100));
        SplitPane.setMinimumSize(new java.awt.Dimension(1024,100));
        SplitPane.setPreferredSize(new java.awt.Dimension(1024,580));
        SplitPane.setOneTouchExpandable(true);
        add(TitlePanel);
        add(SplitPane);

        

    }

    public JSplitPane getSplitPane() {
        return SplitPane;
    }

    public void setSplitPane(JSplitPane SplitPane) {
        this.SplitPane = SplitPane;
    }

    public ETitlePanel getTitlePanel() {
        return TitlePanel;
    }

    public void setTitlePanel(ETitlePanel TitlePanel) {
        this.TitlePanel = TitlePanel;
    }

    public static MainWindow getInstance(){
        //singleton singleton null create one else don't create
        if (singleton == null){
            MainWindow controller = new MainWindow("", null);
            singleton = controller;
            return controller;
        }
        return singleton;
    }



    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
